﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Web;
using QL.Core;
using QL.Web;

namespace CM.UserCenter.Common
{
    public class Configuration : WebSiteConfiguration
    {
        /// <summary>
        /// 获取配置
        /// </summary>
        public static Configuration Default
        {
            get
            {
                return QL.Core.Settings.GetFrom<Configuration>("resources.config");
            }
        }
        /// <summary>
        /// 资源服务器域名地址
        /// </summary>
        public string Domain
        {
            get
            {
                return this.GetData<string>("Domain", "");
            }
            set
            {
                this["Domain"] = value;
            }
        }
        /// <summary>
        /// 上传路径
        /// </summary>
        public string UploadDir
        {
            get
            {
                return this.GetData<string>("UploadDir", "");
            }
            set
            {
                this["UploadDir"] = value;
            }
        }


        /// <summary>
        /// 上传路径
        /// </summary>
        public bool AllowUpload
        {
            get
            {
                return this.GetData<bool>("AllowUpload", false);
            }
            set
            {
                this["AllowUpload"] = value;
            }
        }

        public bool AppDebugModel
        {
            get
            {
                return this.GetData<bool>("AppDebugModel", false);
            }
            set
            {
                this["AppDebugModel"] = value;
            }
        }
        
        /// <summary>
        /// 资源服务器后台访问IP限制
        /// </summary>
        public string LimitIP
        {
            set
            {
                this["LimitIP"] = value;
            }
            get
            {
                return this.GetData<string>("LimitIP", "");
            }
        }
        /// <summary>
        /// 资源服务器站点列表
        /// </summary>
        public string[] SitesArray
        {
            get
            {
                string str = this.GetData<string>("Sites", "");
                if (string.IsNullOrEmpty(str)) { return new string[] { }; }
                return str.Split(',');
            }
        }
        /// <summary>
        /// 资源服务器站点列表
        /// </summary>
        public string Sites
        {
            set
            {
                this["Sites"] = value;
            }
        }

    }
}
